<template>
<van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
            <van-swipe-item v-for="item in bannerList" :kay="item.bannerid">
            <img class="img" :src="item.img">
            </van-swipe-item>
           
        </van-swipe>
</template>
<script name="jdfenlei" lang="ts" setup>
import {getBannerList} from '../../../mode/goods'
import { onMounted,ref } from 'vue';

interface BannerInfo{
    img?:string
    alt?:string
    link?:string
    bannerid?:string
    flag?:boolean
}

interface Respose {
    code : string
    data : Array<BannerInfo>
}

const bannerList = ref<Array<BannerInfo>>([])

onMounted(async ()=>{
    const res = await getBannerList()
    if((res as unknown as Respose).code !== '200') return
    bannerList.value =res.data
    
})
</script>
<style scoped lang="scss">
.my-swipe .van-swipe-item {
    color: #fff;
    font-size: 20px;
    line-height: 150px;
    text-align: center;
}

.my-swipe {
    height: 170px;
    width: 90%;
    margin: 0 auto;
}
.img {
    width: 100%;
    height: 170px;
}
</style>